package org.liulinlin.sejw.db;

import java.sql.*;

public class ContainerLoad {
	private String id;
	private ShipperNote shipperNote;
	private Box box;
	private String loadLoc;
	private String loaderName;
	private String loaderAddr;
	private String loaderTel;
	private String loaderSign;
	private Date loaderSignDate;
	private String loaderSignDateString;
	private String driverSign;
	private String truckNo;
	private String dockSign;
	private Date dockSignDate;
	private String dockSignDateString;
	
	public ContainerLoad() {
		
	}
	public ContainerLoad(String id) {
		DBConnectionManager connMgr = DBConnectionManager.getInstance();
		Connection con = connMgr.getConnection("shipping_export");
		if (con == null) {
			System.out.println("ContainerLoad不能获得数据库连接");
			return;
		}
		
		try {
			Statement stmt = con.createStatement();
			ResultSet rs = stmt.executeQuery("select * from ContainerLoad where CL_ID = '" + id + "'");
		
			rs.next();
			this.id = id;
			shipperNote = new ShipperNote(rs.getString("SN_ID"));
			box = new Box(rs.getString("Box_ID"));
			loadLoc = rs.getString("CL_LoadLoc");
			loaderName = rs.getString("CL_LoaderName");
			loaderAddr = rs.getString("CL_LoaderAddr");
			loaderTel = rs.getString("CL_LoaderTel");
			loaderSign = rs.getString("CL_LoaderSign");
			loaderSignDate = rs.getDate("CL_LoaderSignDate");
			if (loaderSignDate != null) {
				loaderSignDateString = loaderSignDate.toString();
			}
			driverSign = rs.getString("CL_DriverSign");
			truckNo = rs.getString("CL_TruckNo");
			dockSign = rs.getString("CL_DockSign");
			dockSignDate = rs.getDate("CL_DockSignDate");
			if (dockSignDate != null) {
				dockSignDateString = dockSignDate.toString();
			}
			
			stmt.close();
			rs.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		connMgr.freeConnection("shipping_export", con);
		connMgr.release();
	}
	
	public void setId(String id) {
		this.id = id;
	}
	public void setShipperNote(ShipperNote shipperNote) {
		this.shipperNote = shipperNote;
	}
	public void setBox(Box box) {
		this.box = box;
	}
	public void setLoadLoc(String loadLoc) {
		this.loadLoc = loadLoc;
	}
	public void setLoaderName(String loaderName) {
		this.loaderName = loaderName;
	}
	public void setLoaderAddr(String loaderAddr) {
		this.loaderAddr = loaderAddr;
	}
	public void setLoaderTel(String loaderTel) {
		this.loaderTel = loaderTel;
	}
	public void setLoaderSign(String loaderSign) {
		this.loaderSign = loaderSign;
	}
	public void setLoaderSignDate(Date loaderSignDate) {
		this.loaderSignDate = loaderSignDate;
	}
	public void setLoaderSignDateString(String loaderSignDateString) {
		this.loaderSignDateString = loaderSignDateString;
	}
	public void setDriverSign(String driverSign) {
		this.driverSign = driverSign;
	}
	public void setTruckNo(String truckNo) {
		this.truckNo = truckNo;
	}
	public void setDockSign(String dockSign) {
		this.dockSign = dockSign;
	}
	public void setDockSignDate(Date dockSignDate) {
		this.dockSignDate = dockSignDate;
	}
	public void setDockSignDateString(String dockSignDateString) {
		this.dockSignDateString = dockSignDateString;
	}
	
	public String getId() {
		return id;
	}
	public ShipperNote getShipperNote() {
		return shipperNote;
	}
	public Box getBox() {
		return box;
	}
	public String getLoadLoc() {
		return loadLoc;
	}
	public String getLoaderName() {
		return loaderName;
	}
	public String getLoaderAddr() {
		return loaderAddr;
	}
	public String getLoaderTel() {
		return loaderTel;
	}
	public String getLoaderSign() {
		return loaderSign;
	}
	public Date getLoaderSignDate() {
		return loaderSignDate;
	}
	public String getLoaderSignDateString() {
		return loaderSignDateString;
	}
	public String getDriverSign() {
		return driverSign;
	}
	public String getTruckNo() {
		return truckNo;
	}
	public String getDockSign() {
		return dockSign;
	}
	public Date getDockSignDate() {
		return dockSignDate;
	}
	public String getDockSignDateString() {
		return dockSignDateString;
	}
}
